using System;
using Framework.Save;
using LitJson;
using UnityEngine;

namespace GameCore
{
    
    public abstract class Inventory : ManagedPrefab
    {
        public Shape shape;
        public InventoryData data;

        public override GameData GetData() => data;

        #region Abstract Methods
        
        public abstract bool ValidatePlaceItem(Vector2Int gridPos, GridItem gridItem);
        public abstract void PreviewPlaceItem(GridItem item, Vector2Int gridPos);
        public abstract void ClearPreview();
        public abstract void PlaceItem(Vector2Int gridPos, GridItem item);
        public abstract GridItem RemoveItem(Vector2Int gridPos);
        public abstract void DestroyItem(Vector2Int gridPos);
        public abstract void OnCellClicked(Vector2Int gridPos);
        
        #endregion
        
        public virtual void Show()
        {
            gameObject.SetActive(true);
        }
        
        public virtual void Hide()
        {
            gameObject.SetActive(false);
        }
    }
}